import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 引入Element UI
import ElementUI from 'element-ui'
// 单独引入样式文件
import 'element-ui/lib/theme-chalk/index.css'
import store from './store'

Vue.use(ElementUI, { size: 'small', zIndex: 3000 });
Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
    if(to.path == '/login') {next()}
    else {
        if(to.meta.requireAuth && !sessionStorage.getItem('token')) {next({path: '/login'})}
        else {next()}
    }
})
new Vue({
    router,
    store,
    render: h => h(App),
}).$mount('#app')
